import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class RightBackDemo extends StatelessWidget {
  static const String routerName = "/rightBack";
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("右划返回"),),
      body: CupertinoPageScaffold(
        child: Center(
          child: Container(
            width: 100,
            height: 100,
            color: CupertinoColors.activeBlue,
            child: CupertinoButton(
              child: Icon(CupertinoIcons.add,color: Color.fromARGB(333, 333, 333, 333),),
              // 触发事件
              onPressed: (){
                Navigator.of(context).push(
                    CupertinoPageRoute(builder: (BuildContext context){
                      // 每次点击再打开一次当前的页面
                      return RightBackDemo();
                    })
                );
              },
            ),
          ),
        ),
      ),
    );
  }
}